package com.zhangchi.zoombar;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.view.View;

import androidx.annotation.Nullable;

import com.zhangchi.cameraphotograph.R;

public class ScaleView extends View {
    private String TAG = "ScaleView";
    private Paint mPaint;
    private float mWidth;
    private float mHeight;
//    private int longHeight;
//    private int longWidth;
//    private int shortHeight;
//    private int shortWidth;

    public ScaleView(Context context) {
        super(context);
        init();
    }

    public ScaleView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        init();
    }

    public ScaleView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        init();
    }

    public ScaleView(Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) {
        super(context, attrs, defStyleAttr, defStyleRes);
        init();
    }
    private void init(){
        //+ ExtB ASHA-10496,nimeng.wt,modify,2021-03-25,scaleview display error
        mPaint = new Paint();
        mPaint.setStyle(Paint.Style.FILL);
        mPaint.setColor(getResources().getColor(R.color.white));
        mWidth = getResources().getDimensionPixelSize(R.dimen.scale_view_width);


        //longHeight = 2;
        //longHeight = 20;
        //longWidth = 2;
        //shortHeight = 14;
        //shortWidth = 1;
        //- ExtB ASHA-10496,nimeng.wt,modify,2021-03-25,scaleview display error
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);

        //+ ExtB ASHA-10496,nimeng.wt,modify,2021-03-25,scaleview display error
//        for (int i = 0; i < 51; i++){
        mPaint.setStrokeWidth((float) 6.0);
//        mPaint.setStrokeCap(Paint.Cap.ROUND);
        canvas.drawLine(0, 0, mWidth, 0, mPaint);
//            if (i % 10 == 0){
//                //长
//                mPaint.setStrokeWidth(longWidth);
//                canvas.drawLine((float) 7.2*i,0,(float)7.2*i,longHeight,mPaint);
//            } else {
//                //短
//                mPaint.setStrokeWidth((shortWidth));
//                int startY = (longHeight - shortHeight)/2;
//
//                canvas.drawLine((float) 7.2*i,startY,(float)7.2*i,startY+shortHeight,mPaint);
//            }
//        }
        //- ExtB ASHA-10496,nimeng.wt,modify,2021-03-25,scaleview display error
    }
}
